package com.wanyang.controller;

import com.wanyang.service.FollowerService;
import com.wanyang.service.UserContext;
import com.wanyang.vo.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "关注相关api")
@RestController
@RequestMapping("follow")
public class FollowController {

    @Autowired
    private FollowerService followerService;


    @ApiOperation(value = "关注或者取消关注")
    @PostMapping("/{followedId}")
    public ApiResult followOrUnFollow(@PathVariable Integer followedId) {
        followerService.followOrUnFollow(UserContext.get().getId(), followedId);
        return ApiResult.success();
    }


}
